<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListContatoTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="#{bundle.ListContatoEmpty}" rendered="#{contatoController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{contatoController.items.rowCount > 0}">
                    <h:outputText value="#{contatoController.pagination.pageFirstItem + 1}..#{contatoController.pagination.pageLastItem + 1}/#{contatoController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{contatoController.previous}" value="#{bundle.Previous} #{contatoController.pagination.pageSize}" rendered="#{contatoController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{contatoController.next}" value="#{bundle.Next} #{contatoController.pagination.pageSize}" rendered="#{contatoController.pagination.hasNextPage}"/>&nbsp;
                    <p:dataTable value="#{contatoController.items}" var="item" style="border:solid 1px">
                        <p:column headerText="#{bundle.ListContatoTitle_idcontato}">
                            <h:outputText value="#{item.idcontato}"/>
                        </p:column>
                        <p:column headerText="#{bundle.ListContatoTitle_nome}">
                            <h:outputText value="#{item.nome}"/>
                        </p:column>
                        <p:column headerText="#{bundle.ListContatoTitle_email}">
                            <h:outputText value="#{item.email}"/>
                        </p:column>
                        <p:column headerText="#{bundle.ListContatoTitle_fone}">
                            <h:outputText value="#{item.fone}"/>
                        </p:column>
                        <p:column headerText="#{bundle.ListContatoTitle_funcao}">
                            <h:outputText value="#{item.funcao}"/>
                        </p:column>
                        <p:column headerText="">
                            <h:commandLink action="#{contatoController.prepareView}" value="#{bundle.ListContatoViewLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{contatoController.prepareEdit}" value="#{bundle.ListContatoEditLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{contatoController.destroy}" value="#{bundle.ListContatoDestroyLink}"/>
                        </p:column>
                    </p:dataTable>
                </h:panelGroup>
                <br />
                <h:commandLink action="#{contatoController.prepareCreate}" value="#{bundle.ListContatoCreateLink}"/>
                <br />
                <br />
                <h:link outcome="/index" value="#{bundle.ListContatoIndexLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
